package com.android.webttest.model.tableModel;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import lombok.Data;

@Data
@Entity(tableName = "good_share")
public class GoodShare {

    @PrimaryKey(autoGenerate = true)
    private Integer id;

    @ColumnInfo(name = "user_id")
    private Integer userId;

    @ColumnInfo(name = "good_id")
    private Integer goodId;

    @ColumnInfo(name = "share_platform")
    private String sharePlatform;

    @ColumnInfo(name = "create_time")
    private String createTime;

    // 构造方法（可选）
    public GoodShare(Integer userId, Integer goodId, String sharePlatform) {
        this.userId = userId;
        this.goodId = goodId;
        this.sharePlatform = sharePlatform;
        this.createTime = getCurrentTime(); // 复用已有时间工具方法
    }

    private static String getCurrentTime() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()).format(new Date());
    }
}
